<?php


namespace app\api\controller;



use app\api\model\NewsCategoryModel;
use app\api\model\NewsModel;

class News extends ApiBase
{

    /**
     *
     * 新闻分类列表
     */
    public function newsCateList(){

        $data = NewsCategoryModel::newsCateList();
        $this->successful('查询成功',$data);
    }

    /**
     *
     * 新闻列表
     */
    public function newsList(){

        $params = $this->request->post();
        $data = NewsModel::newsList($params);
        $this->successful('查询成功',$data);
    }

    /**
     *
     * 新闻详情
     */
    public function newsInfo(){

        $params = $this->request->get();
        if (!isset($params['id']) || empty($params['id'])){

            $this->fail('缺少新闻详情ID');
        }
        $data = NewsModel::newsInfo($params['id']);
        $this->successful('查询成功',$data);
    }


}